//
//  GameDetailModel.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/5.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class GameDetailModel: NSObject {
    var game_card_price = "-999"
    var game_name = "-999"
    var game_id = "-999"
    var game_desc = "-999"
    var game_star = "-999"
    var game_logo = "-999"
    var game_ios_download_url = "-999"
    var imgs = [String]()
    
    
    init(dic : [String : AnyObject]) {
        super.init()
        
        setValuesForKeys(dic)
        
    }
    
    
    override func  setValue(_ value: Any?, forKey key: String) {
        
        if key == "imgs" {
            
            for item in value as! [String] {
                
                imgs.append(item)
                
                
            }
            
            
        } else {
            
            
            super.setValue(value, forKey: key)
        }
        
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
        
    }
    
    
    //在swift中想要打印对象要以下重写属性
    override var description: String{
        let keys = ["game_card_price","game_name","game_id","game_desc","game_star","game_logo","game_ios_download_url","imgs"]
        let dic = dictionaryWithValues(forKeys: keys)
        return "\(dic)"
    }


}
